import apiFuncs from '@/api';
import * as feedback from '@/common/utils/feedback.js';
import minCacheIns from '@/common/utils/min-cache.js';
import { uuid } from '@/common/utils/get-uuid.js';
import { key_sessionId } from '@/api/config';

export default {
  install (Vue) {    
    // 挂载api函数
    Vue.prototype.$api = apiFuncs;
    // loading&toast
    Vue.prototype.$feedback = feedback;
    // minCache
    Vue.prototype.$minCacheIns = minCacheIns;
		// 手机号码脱敏
		Vue.prototype.$phoneFormat = (phone) => {
			if(!phone) { return '' };
			return phone.slice(0, 3) + '****' + phone.slice(7, 11);
		};
		// wx小程序中，生成唯一的sessionId并通过请求头传递
		minCacheIns.set(key_sessionId, uuid(28, 16));
		
  }
}
